#include <iostream>
#include <string>
using namespace std;

class Int;
ostream& operator<<(ostream &out, const Int &d);
istream& operator>>(istream &in, Int &d);

class Int
{
    friend ostream& operator<<(ostream &out, const Int &d);
    friend istream& operator>>(istream &in, Int &d);

public:
    Int(int d = 0) :data(d)
    {

    }

    Int& operator++() // ++a
    {
        data++;
        return *this;
    }

    Int operator++(int) // a++
    {
        Int tmp(data);
        data++;
        return tmp;
    }
private:
    int data;
};

ostream& operator<<(ostream &out, const Int &d)
{
    out << d.data;
    return out;
}

istream& operator>>(istream &in, Int &d)
{
    in >> d.data;
    return in;
}

int main()
{
    Int d(10);
    Int a;

    a = d++; // a = 10 d = 11
    cout << "a:" << a << endl;
    cout << "d:" << d << endl;

    a = ++d; // a = 12 d = 12
    cout << "a:" << a << endl;
    cout << "d:" << d << endl;

    system("pause");
    return 0;
}
